<?php

namespace App\Models;

use Illuminate\Database\Eloquent\SoftDeletes;
use Slowlyo\OwlAdmin\Models\BaseModel as Model;

/**
 * 对话列表
 */
class AqConversation extends Model
{
	use SoftDeletes;
	protected $table = 'aq_conversations';

	public $primaryKey = 'id';

	public $keyType = 'string';

	public $incrementing = false;

	public $fillable = [
		'id',
		'uid',
		'title',
		'session_id',
		'model_data',
	];
	public $casts = [
		'model_data' => 'json'
	];

	public function details()
	{
		return $this->hasMany(AqConversationDetail::class, 'conversation_id', 'id');
	}

	public function user()
	{
		return $this->belongsTo(PreCommonMember::class, 'uid', 'uid');
	}

}
